<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="button_js_text">0</button>
    <button id="button_js_add">+</button>
    <button id="save">保存</button>
    <button id="read">读取</button>
</body>
</html>
<script>
    button_js_add.onclick = function(){
        button_js_text.innerHTML =  button_js_text.innerHTML * 1 + 1;
    }
    save.onclick = function(){
        //把当前这个数值设置到cookie
        //cookie格式 key = value
        //document.cookie(绘画cookie，浏览器窗口关闭之后自动清除)
        document.cookie = `num = ${button_js_text.innerHTML}`
    }
    read.onclick = function(){
        console.log('当前cookie',document.cookie);
    }
</script>